package samber

import (
	"fmt"
	"github.com/samber/lo"
)

// Last 返回集合的最后一个元素
func Last() {
	list := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 0}
	result, err := lo.Last(list)
	fmt.Printf("%v %v\n", result, err) // 0 <nil>
}

// LastIndexOf 返回数组中最后出现的值所在的索引
func LastIndexOf() {
	list := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 2}
	result := lo.LastIndexOf(list, 2)
	fmt.Printf("%v \n", result)
}
